package org.example.backend.demos.web.volunteerModule.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.example.backend.demos.web.volunteerModule.entity.Volunteer;
import org.example.backend.demos.web.volunteerModule.entity.VolunteerQuery;

@Mapper
public interface VolunteerDao extends BaseMapper<Volunteer> {

    /**
     * 查询用户报名记录
     */
    Page<Volunteer> selectUserApplications(Page<Volunteer> page,
                                           @Param("userId") Long userId,
                                           @Param("status") Integer status);

    /**
     * 管理员查询报名列表
     */
    Page<Volunteer> selectAdminApplicationList(Page<Volunteer> page,
                                               @Param("query") VolunteerQuery query);

    /**
     * 查询报名详情
     */
    Volunteer selectApplicationDetail(@Param("id") Long id);

    /**
     * 检查用户是否已报名某项目
     */
    Boolean existsByUserAndProject(@Param("userId") Long userId, @Param("projectId") Long projectId);

    /**
     * 更新审核状态
     */
    int updateAuditStatus(@Param("id") Long id,
                          @Param("status") Integer status,
                          @Param("auditRemark") String auditRemark,
                          @Param("auditTime") String auditTime);


}